export default {
	data() {
		return {
			disabled: false,
			text: this.$t(`message.login.send`),
		};
	},
	methods: {
		sendCode() {
			if (this.disabled) return;
			this.disabled = true;
			let n = 60;
			this.text = n + " сек.";
			const run = setInterval(() => {
				n = n - 1;
				if (n <= 0) {
					this.disabled = false;
					this.text = this.$t(`message.login.resend`);
					clearInterval(run);
				} else {
					if (this.$i18n.locale === "kz" || this.$i18n.locale === "ru") {
						this.text = n + " сек.";
					} else {
						this.text = n + " s";
					}
				}

				// if (this.text < this.$t(`message.login.remaining`) + 0 + "<<сек.>>") {
				// 	this.disabled = false;
				// 	this.text = this.$t(`message.login.resend`);
				// }
			}, 1000);
		},
	},
};
